import React from "react";
import { createRoot } from "react-dom/client";
import App from "./App";
import "./styles/index.css";
import { environmentConfig, getEnvironment } from "./utils/environment";

const env = getEnvironment();
const config = environmentConfig[env];

console.log(`${config.messagePrefix} Script loaded`); // 调试日志

const container = document.getElementById("root");
if (!container) {
  console.error(`${config.messagePrefix} Root container not found!`);
  document.body.innerHTML = '<div class="text-red-500">Root container missing!</div>';
} else {
  console.log(`${config.messagePrefix} Mounting React app...`); // 调试日志
  const root = createRoot(container);
  root.render(
    <React.StrictMode>
      <App />
    </React.StrictMode>,
  );
}
